//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package weaver.interfaces.expense.action.gzc.th;

import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
import weaver.interfaces.util.ExpenseInfoUtil;

import java.util.Calendar;

public class YZDBHXPLY_TH_ExpenseAction extends BaseBean {
    public YZDBHXPLY_TH_ExpenseAction() {
    }

    public void execute(String workflowid, String requestid) {
        this.writeLog("进入YZDBHXPLY_TH_ExpenseAction-----------" + requestid);
        RecordSet rs = new RecordSet();
        rs.executeSql("select formid from workflow_base where id = " + workflowid);
        rs.next();
        String formid = rs.getString("formid");
        String formtable = "formtable_main_" + formid.replaceAll("-", "");
        String iskt = "0";
        String ccode = "";
        double amount = 0.0D;
        String cexpenseitemcode = "";
        String citemcode = "";
        String iyear = "";
        rs.execute("select id,ks,zcxm,xm,zj,sqrq,kth1,sf from " + formtable + " where requestid=" + requestid);
        rs.next();
        ExpenseInfoUtil expenseInfoUtil = new ExpenseInfoUtil();
        ccode = expenseInfoUtil.getKsbm(Util.null2String(rs.getString("ks")));
        amount = Util.getDoubleValue(rs.getString("zj"), 0.0D);
        citemcode = Util.null2String(rs.getString("xm"));
        cexpenseitemcode = Util.null2String(rs.getString("zcxm"));
        String kth = Util.null2String(rs.getString("kth"));
       // iyear = Util.null2String(rs.getString("sqrq")).substring(0, 4);
        iyear = String.valueOf(Calendar.getInstance().get(Calendar.YEAR));
        String sfkt = Util.null2String(rs.getString("sf"));
        if("0".equals(sfkt)) {
            iskt = "1";
        }

        expenseInfoUtil.releaseExpense(workflowid, ccode, cexpenseitemcode, citemcode, kth, amount, iyear, iskt);
    }
}
